[x11] Fix coordinate space of rect in gdk_x11_surface_get_frame_extents when called...
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 20 Jun 2022 08:11:29 +0000 (10:11 +0200)
committerEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 20 Jun 2022 08:13:21 +0000 (10:13 +0200)
If we take the early return we don't unscale this at the bottom of the
function, causing wrong coordinates in HiDPI screens.

This bug also affects GTK3 (I noticed this running Firefox tests on X).

gdk/x11/gdksurface-x11.c

index fb3b0bd7dfed0b806031c5c3a11ce29e7a27d4de..e21ba9b5b6f98f404b3703cfa089f5264af22ef5 100644 (file)
@@ -2793,14 +2793,19 @@ gdk_x11_surface_get_frame_extents (GdkSurface    *surface,
   impl = GDK_X11_SURFACE (surface);
 
   /* Refine our fallback answer a bit using local information */
-  rect->x = impl->abs_x * impl->surface_scale;
-  rect->y = impl->abs_y * impl->surface_scale;
-  rect->width = surface->width * impl->surface_scale;
-  rect->height = surface->height * impl->surface_scale;
+  rect->x = impl->abs_x;
+  rect->y = impl->abs_y;
+  rect->width = surface->width;
+  rect->height = surface->height;
 
   if (GDK_SURFACE_DESTROYED (surface) || impl->override_redirect)
     return;
 
+  rect->x *= impl->surface_scale;
+  rect->y *= impl->surface_scale;
+  rect->width *= impl->surface_scale;
+  rect->height *= impl->surface_scale;
+
   nvroots = 0;
   vroots = NULL;